/*
  SoilMoisture.h - Library for reading parcentual value
			from soil moisture sensor 
  Copyright (c) 2013 Lukas Vavra.  All right reserved.
*/

// include Arduino wiring library
#include "Arduino.h"
// include this library's description file
#include "SoilMoisture.h"


// Constructor /////////////////////////////////////////////////////////////////
// Function that handles the creation and setup of instances

SoilMoisture::SoilMoisture(int pin)
{
  // initialize this instance's variables
  spin = pin;
  // set pull-up resistor on digital input pin
  digitalWrite(pin, 1);
}

// Public Methods //////////////////////////////////////////////////////////////

int SoilMoisture::getValue(void)
{
  int value = ((int)(100 - (analogRead(spin) / ACONST)));
  return value;
}

